package sysu.el.tuple;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

public class TupleInt2IntMap{
	// Todo: Use FastUtilities to accelerate...
	ArrayList<TupleIntValue> elements;
	TupleIntValue tmp;
	public TupleInt2IntMap(){
		elements = new ArrayList<TupleIntValue>();
		tmp = new TupleIntValue(-1, -1, -1);
	}
	
	public TupleInt2IntMap(int size){
		elements = new ArrayList<TupleIntValue>(size);
	}
	
	public int getInt(int a, int b){
		tmp.a = a; 
		tmp.b = b;
		int t = Collections.binarySearch(elements, tmp);
		if (t >= 0)
			return elements.get(t).value;
		else return -1;
	}

	public boolean add(TupleIntValue e) {
		return elements.add(e);
	}
	
	
}
